package com.dao;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.po.AllRecruitInfoVO;
import com.po.RecruitDetailInfoPO;
import com.po.RecruitPO;
@Repository
public class RecruitDao {
	@Autowired
	private SqlSessionTemplate sqlTemplate;
	/**
	 * 展示招聘信息
	 * @return 
	 */
	public List<RecruitPO> findRecruitInfo() {
		return sqlTemplate.selectList("recruit.findRecruitInfo");
	}
	/**
	 * 回显查找数据
	 * @param id
	 * @return
	 */
	public RecruitPO findRecruitInfoById(String id) {
		return sqlTemplate.selectOne("recruit.findRecruitInfoById", id);
	}
	/**
	 * 修改招聘数据
	 * @param allRecruitInfoVO
	 */
	public void updateInfo(AllRecruitInfoVO allRecruitInfoVO) {
		sqlTemplate.update("recruit.updateInfo", allRecruitInfoVO);
	}
	/**
	 * 添加招聘信息
	 * @param allRecruitInfoVO
	 */
	public int addRecruitInfo(AllRecruitInfoVO allRecruitInfoVO) {
		return sqlTemplate.insert("recruit.addRecruitInfo", allRecruitInfoVO);
	}
	/**
	 * 添加招聘详细信息外键在招聘信息表中
	 * @param id
	 */
	public void addRecruit_fid(int id) {
		sqlTemplate.insert("recruit.addRecruit_fid", id);
	}
	
	/**
	 * 删除招聘信息
	 * @param id
	 */
	public void deleteRecruitInfo(String id) {
		sqlTemplate.delete("recruit.deleteRecruitInfo", id);
	}
	/**
	 * 添加详细的招聘信息
	 * @param allRecruitInfoVO
	 */
	public void addRecruitDetailInfo(AllRecruitInfoVO allRecruitInfoVO) {
		sqlTemplate.insert("recruit.addRecruitDetailInfo", allRecruitInfoVO);
	}
	/**
	 * 查找详细的招聘信息
	 * @param id
	 * @return
	 */
	public RecruitDetailInfoPO findRecruitDetailInfoById(String id) {
		return  sqlTemplate.selectOne("recruit.findRecruitDetailInfoById",id);
	}
	/**
	 * 修改详细的招聘信息
	 * @param allRecruitInfoVO
	 */
	public void updateDetailInfo(AllRecruitInfoVO allRecruitInfoVO) {
		sqlTemplate.update("recruit.updateDetailInfo", allRecruitInfoVO);
	}
	/**
	 * 删除详细的招聘信息
	 * @param id
	 */
	public void deleteDetailInfoById(String id) {
		sqlTemplate.delete("recruit.deleteDetailInfoById", id);
	}
	

}
